maintainer="Hoang Nguyen <folliekazetani@protonmail.com>"
pkgname=tealdeer
pkgver=1.7.0
pkgrel=0
pkgdesc="Very fast implementation of tldr in Rust"
url="https://tealdeer-rs.github.io/tealdeer/"
arch="all"
license="MIT AND Apache-2.0"
makedepends="cargo openssl-dev cargo-auditable"
subpackages="
	$pkgname-bash-completion
	$pkgname-fish-completion
	$pkgname-zsh-completion
	"
source="$pkgname-$pkgver.tar.gz::https://github.com/tealdeer-rs/tealdeer/archive/refs/tags/v$pkgver.tar.gz"

prepare() {
	default_prepare

	cargo fetch --target="$CTARGET" --locked
}

build() {
	cargo auditable build --frozen --release --no-default-features --features native-tls
}

check() {
	cargo test --frozen --no-default-features --features native-tls
}

package() {
	install -Dm755 target/release/tldr -t "$pkgdir"/usr/bin/

	install -Dm644 completion/bash_tealdeer \
		"$pkgdir"/usr/share/bash-completion/completions/tldr
	install -Dm644 completion/fish_tealdeer \
		"$pkgdir"/usr/share/fish/vendor_completions.d/tldr.fish
	install -Dm644 completion/zsh_tealdeer \
		"$pkgdir"/usr/share/zsh/site-functions/_tldr
}

sha512sums="
0d8b919dcefd584b66eea6c88b5b76852fc96f319b5c96cebf49ea85a646c612d8dc328e92c89b2121f86c25ff5e6082b4545533b6abf09e3930c6beb1f4832a  tealdeer-1.7.0.tar.gz
"
